<template>
	<div id="app">
		<div id="news_list">
			<div id="item_name">
			</div>
			<div id="app2">
				<ul v-for="c in news" @click="itemClicked(c)">
					<li>
						<a title="" class="news">
							<div class="pic">
								<img :src="'https://yo.docshare.org.cn'+c.newsbackground">
							</div>
							<div class="project_cont">
								<p>{{c.newstitle}}——{{c.name}}</p>
							</div>
							<div class="price">
								<p>{{c.newsdate}}</p>
								<span>999+</span>
								<i class="am-icon-eye"></i>
								<div class="clear"></div>
							</div>
						</a>
					</li>
				</ul>
			</div>
			<div id="none">
				没有更多了
			</div>
		</div>
		<!--footer-->
		<div id="footer">
			<div class="first">
				<ul class="am-avg-sm-2">
					<li class="active">
						<a title="" @click="uni.navigateTo({
							url:'index'
						})">
							<img src="https://yo.docshare.org.cn/static/images/icon-footer01-a.png" />
							<p>首页</p>
						</a>
					</li>
					<li>
						<a title=""  @click="uni.navigateTo({
							url:'../active/trip_list'
						})">
							<img alt="" src="https://yo.docshare.org.cn/static/images/icon-footer2-a.png" />
							<p>活动</p>
						</a>
					</li>
				</ul>
			</div>
			<div class="beautiful">
				<a title=""  @click="uni.navigateTo({
					url:'../add/my_note'
				})">
					<img alt="" src="https://yo.docshare.org.cn/static/images/icon-footer3-a.png" />
				</a>
			</div>
			<div class="last">
				<ul class="am-avg-sm-2">
					<li>
						<a title=""  @click="uni.navigateTo({
							url:'../map/map'
						})">
							<img alt="" src="https://yo.docshare.org.cn/static/images/icon-footer4-a.png" />
							<p>地图</p>
						</a>
					</li>
					<li>
						<a title=""  @click="uni.navigateTo({
							url:'../user/user_center'
						})">
							<img alt="" src="https://yo.docshare.org.cn/static/images/icon-footer5-a.png" />
							<p>我的</p>
						</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
</template>

<script>
	import config from '@/config'
	export default {
		
		data() {
			return {
			usr: '',
			news: {},
			uni,
			}
		},
		methods: {
			itemClicked:function(item){
				//console.log("进入获取id")
				uni.navigateTo({
					url:`news_detail?id=${item.id}`
				})
			}
		},
		onLoad() {
			var that = this;
			uni.request({
				url: `${config.baseUrl}/news/list?token=` + uni.getStorageSync('token'),
				method: 'GET',
				success(r) {
					if (r.data.succ) {
						that.news = r.data.data;
			
					} else {
						// 可以给个弹窗提示
					}
				},
					complete(res){
						if(res.data && res.data.msg){
							uni.showToast({
								icon:'none',
								title:res.data.msg
							})
						}
					},
			});
		}
	}
</script>

<style>
</style>
